package thread;

import java.util.Scanner;

public class demo10 {
    public static int countPerfectRectangles(int[][] matrix, int size) {
        int count = 0;
        int n = matrix.length;
        for (int row = 0; row <= n - size; row++) {
            for (int col = 0; col <= n - size; col++) {
                int zeroCount = 0;
                int oneCount = 0;
                for (int i = row; i < row + size; i++) {
                    for (int j = col; j < col + size; j++) {
                        if (matrix[i][j] == 0) {
                            zeroCount++;
                        } else {
                            oneCount++;
                        }
                    }
                }
                if (zeroCount == oneCount) {
                    count++;
                }
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();  // 读取换行符，避免影响后续读取矩阵行数据

        int[][] matrix = new int[n][n];
        for (int i = 0; i < n; i++) {
            String line = scanner.nextLine();
            for (int j = 0; j < n; j++) {
                matrix[i][j] = line.charAt(j) - '0';
            }
        }

        for (int i = 1; i <= n; i++) {
            int result = countPerfectRectangles(matrix, i);
            System.out.println(result);
        }

        scanner.close();
    }
}
